from celery import Celery
from app.models.IntruderDatas import IntruderData
import time

celery = Celery("tasks",
                broker="redis://localhost:6379/0",
                backend="redis://localhost:6379/1")

# 服务器上已安装redis，可以使用celery来进行异步操作了
@celery.task
def check_status(topic, type, ts):
    time.sleep(10)
    data = IntruderData.check_status(topic=topic, ts=ts, type=type)
    if data.status != 'ok':
        print("未确认")

